#
# @lc app=leetcode.cn id=118 lang=python3
#
# [118] 杨辉三角
#

# @lc code=start
class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        if numRows == 1:
            return [[1]]
        elif numRows == 2:
            return [[1],[1,1]]
        ang=[[1],[1,1]]
        for i in range(2,numRows):
            ang.append([])
            for j in range(0,i+1):
                if j==0 or j==i:
                    ang[i].append(1)
                else:
                    ang[i].append(ang[i-1][j-1]+ang[i-1][j])
        return ang

# @lc code=end

